home *** CD-ROM | disk | FTP | other *** search
- class Bullet extends MovieClip
- {
- var moveX;
- var moveY;
- var _damage;
- var _holdMovement;
- var _enemy;
- var removeCallback;
- function Bullet()
- {
- super();
- this.moveX = 0;
- this.moveY = 0;
- this._damage = 1;
- this._holdMovement = false;
- }
- function SetMovement(myX, myY)
- {
- this.moveX = myX;
- this.moveY = myY;
- }
- function onEnterFrame()
- {
- if(this._holdMovement == false)
- {
- this._x += this.moveX;
- this._y += this.moveY;
- this.outOfBounds();
- if(this._enemy)
- {
- this.ifHitAvatar();
- }
- }
- }
- function ifHitAvatar()
- {
- if(this.hitTest(_root.pointer.pointerBody))
- {
- if(_root.playerLives >= 2)
- {
- var _loc4_ = "shield_hits2" + _root.getNextHighestDepth();
- var _loc5_ = 1 + Math.floor(Math.random() * 360);
- _root.attachMovie("shield_hits2",_loc4_,_root.getNextHighestDepth());
- _root[_loc4_]._rotation = _root.pointer._rotation + _loc5_;
- _root[_loc4_]._x = this._x;
- _root[_loc4_]._y = this._y;
- }
- this.removeCallback(this._name);
- this.removeMovieClip();
- if(!_global.shieldOn)
- {
- _root.adjustLives();
- }
- }
- }
- function outOfBounds()
- {
- if(this._x < -50 || this._x > 550 || this._y < -50 || this._y > 550 || _global.pauseClicked)
- {
- this.removeCallback(this._name);
- this.removeMovieClip();
- }
- }
- }
-